<%@tag import="itsm.isperp.control.form.process.WorkflowProcesser"%>
<%@ tag language="java" pageEncoding="UTF-8" description="jqGrid 控件."
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@taglib prefix="s" uri="http://www.springframework.org/tags"%>
<%@ attribute name="readonly" required="false" rtexprvalue="true"
	type="java.lang.Boolean" description="默认false"%>
<c:set var="readonly" value="${readonly eq true?true:false }"></c:set>

<script type="text/javascript">
	function formatAppMessageContent(rowObject) {
		var html;
		html = "<div style='padding:0'><div class='ci-failure-info' style='width:100%;'>";
		html = html + "<table class='comment' style='width:100%'>";

		html = html + "<tr>";
		html = html + "<td class='header' colspan='2'>跟踪人员：" + rowObject.creatorName + "&nbsp;&nbsp跟踪时间：" + rowObject.modifyDate;
		html = html + "</td>";
		html = html + "</tr>";

		html = html + "<tr>";
		html = html + "<td class='tdCaption'>内容：";
		html = html + "</td>";
		html = html + "<td class='tdContent' style='white-space:normal;text-overflow:inherit;overflow:inherit'>" + rowObject.content;
		html = html + "</td>";
		html = html + "</tr>";

		html = html + "</table></div></div>";
		//temph="<div style='padding:0'><div class='ci-failure-info'><table class='comment' style='width:100%'><tr><td class='header' colspan='2'>处理人：李四&nbsp;&nbsp处理时间：2015-08-30 11:37</td></tr><tr><td class='tdCaption'>原因分析：</td><td class='tdContent'>ewe</td></tr><tr><td class='tdCaption'>解决办法：</td><td class='tdContent'>wew</td></tr><tr><td class='tdCaption'>处理过程：</td><td class='tdContent'>ewewe</td></tr></table></div></div>";
		return html;
	}
</script>

<div class="box tabbedBox tabbedBoxFixed">
	<div class="header">
		<ul>
			<li class="current"><a href="#basicInfo">工作单基本信息</a></li>
			<li><a href="#relationProcess">关联流程（<label
					id="relationProcessCount" style="color:red"></label>）</a></li>
			<li><a href="#cusTaskMessage">相关消息（<label
					id="cusTaskMessageCount" style="color:red"></label>）</a></li>
			<li><a href="#appMessageRemind">跟踪消息（<label
					id="appMessageRemindCount" style="color:red"></label>）</a></li>
		    <li><a href="#taskProcess">任务进度（<label
					id="taskProcessCount" style="color:red"></label>）</a></li>	
		</ul>
		<h2>&nbsp;</h2>
	</div>
	<div style="padding:0" class="content tabbed">
		<div id="basicInfo">
			<div class="box no-border">
				<div class="header">
					<h3>
						工作单编号：${model.code}&nbsp;&nbsp;状态：<span class="important-info">${model.status}</span>
					</h3>
				</div>
			</div>
			<div class="box" style="overflow: hidden">

				<s:eval
					expression="T(itsm.isperp.control.form.process.WorkflowProcesser).renrder(model.processId)"
					var="processerHtml" />
				${processerHtml }
			</div>

			<jsp:doBody />
		</div>


		<div id="relationProcess">
			<isperp:processRelation businessKey="${model.id }" projectIdValue="${model.projectId }"
				readonly="${readonly }" processKey="taskProcess"
				projectIdControl="projectId" showTotalControl="relationProcessCount"></isperp:processRelation>

		</div>
		<div id="cusTaskMessage">
			<div class="box no-border">

				<isperp:grid
					url="app/message/listBySourceId?all=1&sourceId=${model.id }"
					showSearchbar="false" gridId="userTaskMessageGrid"
					cusViewUrl="app/message/view" cusDialogSize="normal"
					showToolbar="true"
					loadComplete=" $('#cusTaskMessageCount').text( userTaskMessageGrid.jqGrid.getGridParam('records'));">
					<jsp:attribute name="toolbar">
						（备注：消息发送后不会即时显示在列表中）<isperp:button id="userTaskMessageCreate"
							icon="icon-plus" text="发送消息" cssClass="button  nui-mainbtn"
							onclick="isperp.openDialog({contentUrl:'app/message/sender/sendEdit?sourceId=${model.id }'})"></isperp:button>
					</jsp:attribute>
					<jsp:body>
						<isperp:column name="id" title="id" hidden="true"></isperp:column>
						<isperp:column name="sender_name" title="发送人" width="80">
						</isperp:column>
						<isperp:column name="receiver_name" title="接收人" width="80">
						</isperp:column>
						<isperp:column name="content" title="内容" width="300">
						</isperp:column>
						<isperp:column name="message_type" title="发送方式" width="70"
							isFormatterFun="true"
							formatter="if('LEAVEMSG'==cellvalue){return '留言';}else{return cellvalue;}">
						</isperp:column>
						<isperp:column name="create_date" title="发送时间" width="110">
						</isperp:column>
				</jsp:body></isperp:grid>
			</div>
		</div>
		<div id="appMessageRemind">
			<isperp:grid
				url="app/message/remind/listBySourceId?sourceId=${model.id }"
				showSearchbar="false" gridId="appMessageRemindGrid" cusDialogSize="normal"
				showToolbar="true" rownumbers="false" height="auto"
				cusFormatterActions="false"
				loadComplete=" $('#appMessageRemindCount').text( appMessageRemindGrid.jqGrid.getGridParam('records'));">
				<jsp:attribute name="toolbar">
						<isperp:button id="appMessageRemindCreate" icon="icon-plus"
						text="添加" cssClass="button  nui-mainbtn"
						onclick="isperp.openDialog({title:'跟踪消息',windowSize:'small',contentUrl:'app/message/remind/msgRemindEdit?type=task&sourceId=${model.id }&pcontrolid=appMessageRemindGrid'})"></isperp:button>
					</jsp:attribute>
					<jsp:body>
				<isperp:column name="id" title="id" hidden="true"></isperp:column>
				<isperp:column name="content" title="跟踪内容" isFormatterFun="true"
					formatter="return formatAppMessageContent(rowObject);"></isperp:column>
				<isperp:column name="modifyDate" title="处理时间" hidden="true">
				</isperp:column>
				<isperp:column name="creatorName" title="创建者" hidden="true">
				</isperp:column>
				</jsp:body>
			</isperp:grid>
		</div>
		
		<div id="taskProcess">
			 <isperp:taskProcess sourceId="${model.id }">
			  
			 </isperp:taskProcess>
		</div>

	</div>
</div>